#include<stdio.h>
const int N=55;
char ch[5] = {'S','H','C','D','J' };
int start[55], end[55], ord[55];
int main() {
	int k;
	scanf("%d", &k);
	for (int i = 1; i < N; i++) {
		start[i] = i;
	}
	for (int i = 1; i < N; i++) {
		scanf("%d", &ord[i]);
	}
	for (int i = 0; i < k; i++) {
		for (int j = 1; j < N; j++) {
			end[ord[j]] = start[j];
		}
		for (int j = 1; j < N; j++) {
			start[j] = end[j];
		}
	}
	for (int i = 1; i <= 54; i++) {
		if (i - 1) 
        printf(" ");
		printf("%c%d", ch[(start[i]-1) / 13], (start[i] - 1) % 13 + 1);
	}
	return 0;
}
//Shuffling Machine